﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ReportInventory.ascx.cs" Inherits="ERP.Modules.Report.ReportInventory" %>

<%-------------------------------%>
<ext:Hidden ID="FormatTypeReportInventory" runat="server" />
<ext:Panel runat="server" Layout="Fit" Border="False" ID="PanelReportInventory">
    <Content>
        <%--------------GridReportInventory-----------------%>
        <ext:GridPanel
            ID="grReportInventory"
            Cls="grid-double"
            runat="server"
            EnableColumnMove="true"
            Border="False">
            <Store>
                <%-------------StoreReportInventory-----------------%>
                <ext:Store
                    ID="StoreReportInventory"
                    runat="server"
                    OnReadData="StoreReportInventory_RefreshData"
                    PageSize="20">
                    <Model>
                        <ext:Model ID="ModelReportInventory" runat="server" IDProperty="LockWarehouse_ID">
                            <Fields>
                                <ext:ModelField Name="LockWarehouse_User" Type="String" />
                                <ext:ModelField Name="LockWarehouse_No" Type="String" />
                                <ext:ModelField Name="LockWarehouse_Date" Type="Date" />
                                <ext:ModelField Name="LockWarehouse_Note" Type="String" />
                                <ext:ModelField Name="LockWarehouse_Test" Type="String" />
                                <ext:ModelField Name="LockWarehouse_Detail_TD" Type="Int" />
                                <ext:ModelField Name="LockWarehouse_Detail_NTK" Type="Int" />
                                <ext:ModelField Name="LockWarehouse_Detail_XTK" Type="Int" />
                                <ext:ModelField Name="LockWarehouse_Detail_TC" Type="Int" />
                                <ext:ModelField Name="LockWarehouse_Detail_Test" Type="Int" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:RowNumbererColumn ID="RowNumbererColumn1" Text="STT" runat="server" Width="30" Align="Center" />
                    <ext:Column ID="Column2" runat="server" Text="Người chốt" Width="150" DataIndex="LockWarehouse_User"></ext:Column>
                    <ext:DateColumn ID="Column3" runat="server" Text="Ngày chốt" DataIndex="LockWarehouse_Date" Format="dd-MM-yyyy"></ext:DateColumn>
                    <ext:Column ID="Column1" runat="server" Text="Tồn đầu" DataIndex="LockWarehouse_Detail_TD"></ext:Column>
                    <ext:Column ID="Column5" runat="server" Text="Nhập TK" DataIndex="LockWarehouse_Detail_NTK"></ext:Column>
                    <ext:Column ID="Column6" runat="server" Text="Xuất TK" DataIndex="LockWarehouse_Detail_XTK"></ext:Column>
                    <ext:Column ID="Column7" runat="server" Text="Tồn cuối" DataIndex="LockWarehouse_Detail_TC"></ext:Column>
                    <ext:Column ID="Column9" runat="server" Text="SL kiểm tra" DataIndex="LockWarehouse_Detail_Test"></ext:Column>
                    <ext:Column ID="Column8" runat="server" Text="Người kiểm tra" DataIndex="LockWarehouse_Test"></ext:Column>
                    <ext:Column ID="Column4" runat="server" Text="Ghi chú" Width="100" DataIndex="LockWarehouse_Note" Flex="1"></ext:Column>
                </Columns>
            </ColumnModel>
            <DirectEvents>
                <ItemDblClick OnEvent="ReportInventoryDblClick">
                    <ExtraParams>
                        <ext:Parameter Name="ReportInventory_ID" Value="record.data.LockWarehouse_ID" Mode="Raw" />
                    </ExtraParams>
                    <EventMask ShowMask="true" Msg="Đang tải..." />
                </ItemDblClick>
            </DirectEvents>
            <SelectionModel>
                <ext:CheckboxSelectionModel ID="CheckboxSelectionModelReportInventory" runat="server" Mode="Multi">
                    <Listeners>
                        <SelectionChange Handler="
                            if (selected.length == 0) {
                                #{btnEdit}.disable();
                                #{btnDel}.disable();
                                #{btnExport}.disable();
                            } else {
                                #{btnEdit}.enable();
                                #{btnDel}.enable();
                                #{btnExport}.enable();
                            }" />
                    </Listeners>
                </ext:CheckboxSelectionModel>
            </SelectionModel>
            <DockedItems>
                <ext:Toolbar ID="ToolbarTopMain" runat="server" Dock="Top">
                    <Items>
                        <ext:Button ID="btnExport" runat="server" Text="Xuất tập tin" Icon="Printer">
                            <Menu>
                                <ext:Menu ID="MenuMain" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="MenuItemExportXML" runat="server" Text="XML" Icon="PageCode">
                                            <Listeners>
                                                <Click Handler="submitValue(#{grReportInventory}, #{FormatTypeReportInventory}, 'xml');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>

                    </Items>
                </ext:Toolbar>
                <ext:Toolbar ID="ToolbarPagging" runat="server" Dock="Bottom" AnchorHorizontal="100%">
                    <Items>
                        <ext:TriggerField ID="txtSearch" runat="server" Width="200" EnableKeyEvents="true" MarginSpec="0 8 0 0">
                            <Triggers>
                                <ext:FieldTrigger Icon="Search" />
                            </Triggers>
                            <DirectEvents>
                            </DirectEvents>
                        </ext:TriggerField>
                        <ext:PagingToolbar ID="PagingToolbarReportInventory" runat="server" StoreID="StoreReportInventory" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                    </Items>
                </ext:Toolbar>
            </DockedItems>
        </ext:GridPanel>
    </Content>
</ext:Panel>
<ext:Panel ID="Panel1" runat="server">
    <Content>
        <%-----------WindowsReportInventory-----------------%>
        <ext:Window ID="WindowsReportInventory" runat="server"
            Title="Cập nhật chốt kho"
            DefaultAnchor="100%"
            Width="832px"
            Height="531px"
            Hidden="true"
            AutoScroll="false"
            Maximizable="False"
            Minimizable="False"
            AutoDataBind="true"
            Region="Center"
            Resizable="false"
            Modal="true"
            HideMode="Offsets"
            Border="false"
            Padding="5"
            DefaultButton="btnSavePopUp">
            <Items>
                <ext:Toolbar ID="ToolbarReportInventory" runat="server">
                    <Items>
                        <ext:Button runat="server" Text="Huỷ bỏ" Icon="Decline" ID="btnCancelPopUp">
                            <Listeners>
                                <Click Handler="#{WindowsReportInventory}.hide();"></Click>
                            </Listeners>
                        </ext:Button>
                        <ext:TextField ID="txtReportInventory_ID" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="true" />
                    </Items>
                </ext:Toolbar>
                <ext:FormPanel ID="FormPanelReportInventory" runat="server"
                    AutoHeight="true"
                    BodyPadding="10"
                    Frame="true"
                    DefaultAnchor="100%">
                    <Items>
                        <ext:TextField ID="txtReportInventory_No" runat="server" FieldLabel="Mã chốt kho" AnchorHorizontal="100%" AllowBlank="false" />
                        <ext:TextField ID="txtReportInventory_Test" runat="server" FieldLabel="Người kiểm tra" AnchorHorizontal="100%" AllowBlank="false" />
                        <ext:TextArea ID="txtReportInventory_Note" runat="server" FieldLabel="Ghi chú" AnchorHorizontal="100%" />
                        <ext:GridPanel
                            ID="grReportInventory_Detail"
                            Cls="grid-double"
                            runat="server"
                            EnableColumnMove="true"
                            AutoWidth="true"
                            AutoScroll="true"
                            Layout="Fit"
                            Height="300">
                            <Store>
                                <ext:Store
                                    ID="StoreReportInventory_Detail"
                                    runat="server"
                                    OnReadData="StoreReportInventory_Detail_RefreshData">
                                    <Model>
                                        <ext:Model ID="ModelReportInventory_Detail" runat="server" IDProperty="Warehouse_Id">
                                            <Fields>
                                                <ext:ModelField Name="Warehouse_Alias" Type="String" />
                                                <ext:ModelField Name="Warehouse_Name" Type="String" />
                                                <ext:ModelField Name="LockWarehouse_Detail_TD" Type="Int" />
                                                <ext:ModelField Name="LockWarehouse_Detail_NTK" Type="Int" />
                                                <ext:ModelField Name="LockWarehouse_Detail_XTK" Type="Int" />
                                                <ext:ModelField Name="LockWarehouse_Detail_TC" Type="Int" />
                                                <ext:ModelField Name="LockWarehouse_Detail_Test" Type="Int" />
                                                <ext:ModelField Name="LockWarehouse_Detail_TestName" Type="String" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <ColumnModel runat="server">
                                <Columns>
                                    <ext:RowNumbererColumn ID="RowNumbererColumn2" Text="STT" runat="server" Width="30" Align="Center" />
                                    <ext:Column ID="Column10" runat="server" Text="Mã kho" Width="100" DataIndex="Warehouse_Alias" />
                                    <ext:Column ID="Column11" runat="server" Text="Tên kho" Width="100" DataIndex="Warehouse_Name" />
                                    <ext:Column ID="Column12" runat="server" Text="Tồn đầu" Width="90" DataIndex="LockWarehouse_Detail_TD" />
                                    <ext:Column ID="Column25" runat="server" Text="Nhập TK" Width="90" DataIndex="LockWarehouse_Detail_NTK" />
                                    <ext:Column ID="Column26" runat="server" Text="Xuất TK" Width="90" DataIndex="LockWarehouse_Detail_XTK" />
                                    <ext:Column ID="Column27" runat="server" Text="Tồn cuối" Width="90" DataIndex="LockWarehouse_Detail_TC" />
                                    <ext:Column ID="Column13" runat="server" Text="SL kiểm tra" Width="90" DataIndex="LockWarehouse_Detail_Test">
                                        <Editor>
                                            <ext:NumberField runat="server" MinValue="0">
                                            </ext:NumberField>
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column14" runat="server" Text="Người kiểm tra" Width="90" DataIndex="LockWarehouse_Detail_TestName" Flex="1">
                                        <Editor>
                                            <ext:TextField runat="server" MinValue="0">
                                            </ext:TextField>
                                        </Editor>
                                    </ext:Column>
                                </Columns>
                            </ColumnModel>
                        </ext:GridPanel>
                    </Items>
                </ext:FormPanel>
            </Items>
        </ext:Window>
    </Content>
</ext:Panel>
